
<%@include file="/include/struts-tags.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<%@include file="/include/head.jsp" %>
<script>
function findItem(codigo){
    var form = opener.document.getElementById("librosForm");
    if (form != null){
        form.cmd.value = "llenarForm";
        form.isbn.value = codigo;
    } else {
        form = opener.document.getElementById("prestamoLibroForm");
        form.cmd.value = "cargarLibro";
        form.isbnLibro.value = codigo;
    }
    form.submit();
    self.close();
}
</script>
<body>
    <html:form action="/Libro">
        <html:hidden property="cmd" value="buscarLibro"/>
        <table class="form">
            <caption class="titleSeg">Búsqueda de libros</caption>
            <tr class="campos" >
                <td class="label">No. ISBN:&nbsp;</td>
                <td class="control"><html:text property="isbn"/></td>
                <td width="25px"></td>
                <td class="label">T&iacute;tulo:&nbsp;</td>
                <td class="control"><html:text property="titulo"/></td>
            </tr>
            <tr class="campos" >
                <td class="label">Autor:&nbsp;</td>
                <td class="control"><html:text property="autor"/></td>
                <td></td>
                <td class="label">Categor&iacute;a:&nbsp;</td>
                <td class="control"><html:text property="categoria"/></td>
            </tr>
            <tr>
                <td colspan="5" align="center">
                    <html:submit value="Buscar"/>
                </td>
            </tr>
        </table>
    </html:form>
    <hr/>
    <logic:present name="librosList" scope="request">
        <display:table  pagesize="10" name="librosList" requestURI="" export="true" style="width:90%;" class="results" id="results">
            <display:column property="isbn" title="Listo" sortable="true" decorator = "com.uca.sisbec.decorators.LibroDecorator" />
            <display:column property="titulo" title="Titulo" sortable="true" headerClass="sortable"/>
            <display:column property="autor" title="Autor" sortable="true" headerClass="sortable" />
            <display:column property="categoria" title="Categoria" sortable="true" headerClass="sortable" />
            <display:column property="unidades" title="Unidades" sortable="true" headerClass="sortable" />
            <display:column property="disponibles" title="Disponibles" sortable="true" headerClass="sortable" />                
        </display:table>
        <script>
            var table = document.getElementById("results");
            var rows = table.getElementsByTagName("tr");
            for (var i = 1; i < rows.length; i++) {
                    rows[i].onmouseover = function() {
                            this.className += ' hilite';
                    }
                    rows[i].onmouseout = function() {
                            this.className = this.className.replace(' hilite', '');
                    }
            }
        </script>
    </logic:present>
</body>
</html>